function NavBarController() {
// bind event listeners to button clicks //
    var that = this;

// handle user logout //
    $('#btn-home').click(function () {
        window.location.href = '/home';
    });
    $('#btn-logout').click(function () {
        that.attemptLogout();
    });
    $('#btn-excel').click(function () {
        window.location.href = '/excel';
    });

    $('#btn-account').click(function () {
        // window.location.href = '/account-show';
        window.location.href = '/account-show?update=' + 2; //默认跳转到用户信息更新页面
    });

    //设置默认加载第一会议室的预约列表
    var curRoomdId = '1';
    $('#btn-reservation').click(function () {
        window.location.href = '/reservation?roomId=' + curRoomdId;
    });
    $('#btn-information').click(function () {
        window.location.href = '/information';
    });

    //设置是否显示用户账号管理按钮, 不仅仅隐藏，还有在服务器进行判断。
    $.post('/account-check', function (result) {
        console.log('account-check  result ----- ' + result.id);
        if (result.id == 1) { //管理员，只有管理员才显示用户账号管理 （普通用户和特殊用户不显示）
            // $('#btn-manage-account').attr("disabled",false);
            // $('#btn-manage-account').show();
            $('#btn-manage-account').css('visibility', 'visible');
        } else {
            // $('#btn-manage-account').hide();
            $('#btn-manage-account').css('visibility', 'hidden');
            // $('#btn-manage-account').attr("disabled","disabled");
        }
    });

    //用户账号管理，管理员页面
    $('#btn-manage-account').click(function () {
        window.location.href = '/account-manage';
    });

    this.attemptLogout = function () {
        var that = this;
        $.ajax({
            url: "/logout",
            type: "POST",
            data: {logout: true},
            success: function (data) {
                that.showLockedAlert('回到首页');
            },
            error: function (jqXHR) {
                console.log(jqXHR.responseText + ' :: ' + jqXHR.statusText);
            }
        });
    };

    this.showLockedAlert = function (msg) {
        $('.modal-alert').modal({show: false, keyboard: false, backdrop: 'static'});
        $('.modal-alert .modal-header h4').text('退出成功!');
        $('.modal-alert .modal-body p').html(msg);
        $('.modal-alert').modal('show');
        $('.modal-alert button').click(function () {
            window.location.href = '/';
        });
        setTimeout(function () {
            window.location.href = '/';
        }, 3000);
    }
}